import { commoditysList, deletecommoditys, addcommoditys, updatecommoditys } from '@/api/commoditys'
import axios from "axios"
export default {
    namespaced: true,
    state: {
        commoditysstate: []
    },
    getters: {
        commoditysgetter(state) {
            return state.commoditysstate
        }
    },
    mutations: {
        commoditysMtt(state, payload) {
            state.commoditysstate = payload
        },

        deletecommoditysMtt(state, payload) {
            state.commoditysstate = payload
        },

        updatecommoditysMtt(state, payload) {
            state.commoditysstate = payload
        },

        addcommoditysMtt(state, payload) {
            state.commoditysstate = payload
        },
    },
    actions: {
        commoditysAction(context) {
            commoditysList().then((res) => {
                context.commit("commoditysMtt", res.rows)
            })
        },
        //删除
        deletecommoditysAction(context, deleteId) {
            deletecommoditys(deleteId)
        },
        //修改
        updatecommoditysAction(context, updateForm) {
            updatecommoditys(updateForm)
        },
        //增加
        addcommoditysAction(context, addForm) {
            console.log();
            addcommoditys(addForm)
        }
    }
}